﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class DoctorPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["Name"] == null)
            {
                Response.Write("<script>alert('你还没登录，请先登录账号！');window.location.href='Logon.aspx';</script>");
            }
            else
            {
                string DocName = Session["Name"].ToString();
                string sql = string.Format("select * from Doctor where ID='{0}'", DocName);
                SqlDataReader dr = DBHelper.GetDataReader(sql);
                while (dr.Read())
                {
                    LblName.Text = dr["Name"].ToString();
                }
                dr.Close();
            }
        }
    }

    protected void LinkTc_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Session.Clear();
        Response.Redirect("Logon.aspx");
    }
}
